package cn.training.service;

import java.util.List;

import jp.terasoluna.fw.dao.QueryDAO;
import jp.terasoluna.fw.dao.UpdateDAO;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.training.bean.UserBean;

@Service
public class HelloWorldService {

	@Autowired
	QueryDAO queryDao;//jiansuo

	@Autowired
	UpdateDAO updateDao;//zeng  shan  gai

	//UpdateDAO updateDao=new updateDao();
	
	public List<UserBean> searchUser(UserBean frm) {
		//UserBean result= queryDao.executeForObject("User.selectUser", frm, UserBean.class);
		//frm = queryDao.executeForObject("User.selectUser", frm, UserBean.class);
		List<UserBean> result = queryDao.executeForObjectList("User.selectUser", frm);
		//frm.setUserId("test");
		
		return result;
	}
	public int insert(UserBean frm){
		return updateDao.execute("User.insertUser", frm);
	}

	public int update(UserBean frm){
		return updateDao.execute("User.updateUser", frm);
	}
	
	public int delete(UserBean frm) {
		// TODO Auto-generated method stub
		return updateDao.execute("User.deleteUser", frm);
	}
  
}
